2821 hi l1c use hi goodtimes in pset processing#2829
2821 hi l1c use hi goodtimes in pset processing#2829subagonsouth wants to merge 7 commits intoIMAP-Science-Operations-Center:devfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Integrates Hi L1B goodtimes culling into the Hi L1C PSET pipeline so that DE counts and exposure time exclude events/clock ticks that fall in bad-time intervals.
Changes:
- Threaded a
goodtimes_dsdependency through Hi L1C PSET generation and addedgood_time_and_phase_mask()for filtering usingcull_flags. - Updated CLI Hi L1C PSET processing to require/load a goodtimes dependency and tightened dependency validation.
- Expanded/updated unit tests and external-data tests to cover goodtimes filtering behavior and reduce fixture duplication.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
imap_processing/hi/hi_l1c.py |
Adds goodtimes-aware filtering for PSET counts/exposure and introduces good_time_and_phase_mask() based on cull_flags. |
imap_processing/cli.py |
Loads/validates goodtimes as an explicit dependency for Hi L1C PSET processing. |
imap_processing/tests/hi/test_hi_l1c.py |
Adds fixtures and new tests verifying goodtimes filtering in counts/exposure and mask logic. |
imap_processing/tests/test_cli.py |
Updates CLI test inputs for Hi L1C PSET to include the goodtimes dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
tech3371
left a comment
There was a problem hiding this comment.
minor comments. looks good!
| # Compute spacecraft spin phase first (used for goodtimes filtering) | ||
| spacecraft_spin_phase = np.atleast_1d(get_spacecraft_spin_phase(mid_tick_mets)) | ||
|
|
||
| # Convert spacecraft spin phase to nominal_bins (0-89) for goodtimes lookup |
There was a problem hiding this comment.
what does 0-89 represents? 4 degree size bin? If so, can you assign 90 to variable?
| # Compute instrument spin phase from spacecraft spin phase | ||
| # This implementation is identical to spin.get_instrument_spin_phase and | ||
| # is replicated here to avoid querying the spin dataframe again. | ||
| instrument_frame = SpiceFrame[f"IMAP_HI_{sensor_number}"] | ||
| phase_offset = get_spacecraft_to_instrument_spin_phase_offset(instrument_frame) | ||
| spin_phases = (spacecraft_spin_phase + phase_offset) % 1.0 |
There was a problem hiding this comment.
helpful comment. is this a big performance concerns? If not, it would be nice to avoid duplicate code and may get us in the future.
Summary
This PR integrates goodtimes filtering into the Hi L1C PSET algorithm. Events and exposure time clock ticks that fall within "bad" times (as identified by the goodtimes product) are now excluded from the L1C counts and exposure time calculations.
Changes
imap_processing/hi/hi_l1c.py
imap_processing/cli.py
imap_processing/tests/hi/test_hi_l1c.py
Closes: #2821